#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e6 + 10;
int z[N] , f[N];
LL n , m , s;
int main()
{
  cin >> n >> m;
  for(int i = 1; i <= n; ++i)
  {
    int x; cin >> x;
    if(abs(x) <= m && x > 0)
    {
      z[x]++;
    }
    else if(abs(x) <= m && x < 0)
    {
      f[-x]++;
    }
    else if(x == 0)
    {
      s++;
    }
  }
  for(int i = 1; i <= m; ++i)
  {
    f[i] += f[i - 1];
    z[i] += z[i - 1];
  }

  int sum = max(f[m],z[m]);

  for(int i = 1; i <= m / 2; ++i)
  {
      int tmp2 = f[i] + z[m - 2 * i];
    int tmp1 = z[i] + f[m - 2 * i];
    
    sum = max({sum,tmp1,tmp2});
  }
    sum += s;
  cout << sum;
  return 0;
}
